// home小仓库
// 引入request
import request from '../../api/request.js'

const state = {
	bannerList: [],
	iconList:[],
	recommendList:[]
}

const actions = {
	// 轮播图
	async bannerList(context) {
		let result = await request({
			method: "get",
			url: "/home/banner",
		})
		context.commit('BANNERLIST',result.result)
	},
	
	// 分类图标
	async iconList(context){
		let result=await request({
			url:'/home/category/mutli',
			method:'get'
		})
		
		context.commit('ICONLIST',result.result)
	},
	
	//热门推荐
	async recommendList(context){
		let result=await request({
			url:'/home/hot/mutli',
			method:'get'
		})
		
		context.commit('RECOMMENDLIST',result.result)
	},
	
	

}

const mutations = {
	//轮播图
	BANNERLIST(state, data) {
		state.bannerList = data
	},
	//分类图标
	ICONLIST(state,data){
		state.iconList=data
	},
	//热门推荐
	RECOMMENDLIST(state,data){
		state.recommendList=data
	}
}



const getters = {

}


export default {
	// 开启命名仓库
	namespaced: true,
	state,
	mutations,
	actions,
	getters
}